import Vue from 'vue'
import Vuex from 'vuex'
import Axios from 'admin/config/axios'

Vue.use(Vuex);

const state = {
	user :{},
    footer_active : 0,
}

const mutations = {
    //用户
	USER(state,data){
        if(data.headimgurl=='' || data.headimgurl==null){
            data.headimgurl = require('touch/assets/home/head.png');
        }
        state.user = data;
    },
    FOOTER_ACTIVE(state,active){
        state.footer_active = active;
    }
}

const actions = {
    //用户赋值
    SET_USER({commit,state},user){
        commit('USER',user);
    },
    SET_FOOTER_ACTIVE({commit,state},active){
        commit('FOOTER_ACTIVE',active);
    }
}

const getters= {
    //用户
    user:function(state){
        return state.user;
    },
    //底部菜单选中
    footer_active:function(state){
        return state.footer_active;
    },
}

const store = new Vuex.Store({
  	state : state,
  	mutations : mutations,
  	actions : actions,
  	getters : getters,
})
export default store;